$('#return').click(function(e){
    window.history.back(-1); 
    e.prevent();
})


//定义头部系统顶部背景颜色
if(window.plus){
    readyPlus();
}else{
document.addEventListener('plusready',function(){
    readyPlus();
})
}

//定义一个plus就绪事件处理函数
function readyPlus(){
// console.log('plus已经就绪');
var type = plus.os.name;	
if(type == "iOS") {					
    plus.navigator.setStatusBarBackground("#000000");		
} else {					
    plus.navigator.setStatusBarBackground("#1448AE");				
}
}

//浏览历史模拟数据
var historyData=[
    {
        id:"100002025",
        src:"history-lis0421_03.jpg",
        title:"云南昆明+大理+丽江+西双版纳 8日7晚跟团游·享4飞经典套餐...",
        price:"¥2900"
    },
    {
        id:"100002026",
        src:"history-lis0421_06.jpg",
        title:"海南三亚6日5晚跟团游(5钻)纯薄款·限时促！红树林酒店1...",
        price:"¥3969"
    },
    {
        id:"100002027",
        src:"history-lis0421_08.jpg",
        title:"摄影之旅·广西桂林+漓江+阳朔 +南宁+德天瀑布+巴马+北海...",
        price:"¥3021"
    },
    {
        id:"100002028",
        src:"history-lis0421_10.jpg",
        title:"乐园游·泰国普吉岛7日跟团游 (5钻)·【A线直飞】0自费 全程...",
        price:"¥5596"
    },
    {
        id:"100002029",
        src:"history-lis0421_12.jpg",
        title:"巴厘岛7日5晚自由行(5钻)2晚 私密别墅+3晚海边酒店·蜜月...",
        price:"¥5963"
    },
    {
        id:"100002030",
        src:"history-lis0421_14.jpg",
        title:"九江+景德镇+婺源4日跟团游 (4钻)·花开正浓 梯田花海深...",
        price:"¥2966"
    }
]

var todayData=historyData.splice(0,3);
var yesterdayData=historyData.splice(0,1);
var beforedayData=historyData.splice(0,2);
// console.log(beforedayData);

var todayHtmlStr='';
var yesterdayHtmlStr='';
var beforedayHtmlStr='';

$.each(todayData,function(index,item){
    // console.log(index,item);
    todayHtmlStr+='<a href="travelDatail.html?id='+item.id+'"><div class="today-trip"><p class="icon-flag skeleton"></p><ul><li class="skeleton"><p>'+item.title+'</p><p><span class="price">'+item.price+'</span> 起</p></li><li class="skeleton"><img src="images/img/'+item.src+'"></li></ul><div class="arrowhead"></div><div class="line-trip"></div></div></a>';
})


$.each(yesterdayData,function(index,item){
    // console.log(index,item);
    yesterdayHtmlStr+='<a href="travelDatail.html?id='+item.id+'"><div class="today-trip"><p class="icon-flag skeleton"></p><ul><li class="skeleton"><p>'+item.title+'</p><p><span class="price">'+item.price+'</span> 起</p></li><li class="skeleton"><img src="images/img/'+item.src+'"></li></ul><div class="arrowhead"></div><div class="line-trip"></div></div></a>';
})

$.each(beforedayData,function(index,item){
    // console.log(index,item);
    beforedayHtmlStr+='<a href="travelDatail.html?id='+item.id+'"><div class="today-trip"><p class="icon-flag skeleton"></p><ul><li class="skeleton"><p>'+item.title+'</p><p><span class="price">'+item.price+'</span> 起</p></li><li class="skeleton"><img src="images/img/'+item.src+'"></li></ul><div class="arrowhead"></div><div class="line-trip"></div></div></a>';
})

$('.history-today').append(todayHtmlStr);
$('.history-today').find('.line-trip').last().removeClass();
$('.history-yesterday').append(yesterdayHtmlStr);
$('.history-yesterday').find('.line-trip').last().removeClass();
$('.history-beforeday').append(beforedayHtmlStr);
$('.history-beforeday').find('.line-trip').last().removeClass();

$(function(){
    // console.log('加载完毕');
    setTimeout(() => {
        $('body div').removeClass('skeleton');
        $('body p').removeClass('skeleton');
        $('body ul li').removeClass('skeleton');
    }, 500)
})

$('.btn-clear').click(function(){
    confirm('您确认要清空浏览历史吗？')
})